package template_funcs

import (
	template_funcs_util "app/app_src/framework/template/funcs/util"
	"strconv"
	"time"
)

type AppStaticFunc func(url string) string

func NewAppStaticFunc(mappingUrls map[string]string) AppStaticFunc {
	result := func(url string) string {
		mappedUrl := template_funcs_util.GetMappedUrl(mappingUrls, url)
		// URL 后拼接参数防止请求被浏览器缓存
		newUrl := mappedUrl + "?t=" + strconv.FormatInt(time.Now().Unix(), 10)

		return newUrl
	}

	return result
}
